/*
 * AnalysisPanel.java
 *
 * Created on August 22, 2007, 8:11 PM
 * 
 * Copyright 2008 David D. Emory
 * 
 * This file is part of Five Points. See <http://www.fpdev.org> for
 * additional information regarding the project.
 * 
 * Five Points is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Five Points is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Five Points.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.fpdev.apps.rtemaster.gui;

import java.awt.BorderLayout;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.fpdev.apps.rtemaster.RouteMaster;
import org.fpdev.util.gui.GUIFactory;

/**
 *
 * @author demory
 */
public class AnalysisPanel extends JPanel {

  private JTabbedPane tabbedPane_;

  private TripPlannerPanel tripPlannerPanel_;
  private VisualizerPanel visualizerPanel_;

  /** Creates a new instance of AnalysisPanel */
  public AnalysisPanel(RouteMaster ac) {
    super(new BorderLayout());
    tripPlannerPanel_ = new TripPlannerPanel(ac);
    visualizerPanel_ = new VisualizerPanel(ac);

    String iconRoot = ac.getEngine().getProperty("5pHome") + "img" + File.separator;
    tabbedPane_ = new JTabbedPane();
    tabbedPane_.addTab("Trip Planner", new ImageIcon(iconRoot+"feet22.png"), tripPlannerPanel_);
    tabbedPane_.setToolTipTextAt(0, "Trip Planner");
    tabbedPane_.addTab("Visualizer", new ImageIcon(iconRoot+"camera22.png"), visualizerPanel_);
    tabbedPane_.setToolTipTextAt(1, "Visualizer");
    tabbedPane_.setFont(GUIFactory.MAIN_FONT);


    tabbedPane_.addChangeListener(new ChangeListener() {

      @Override
      public void stateChanged(ChangeEvent e) {
        switch (tabbedPane_.getSelectedIndex()) {
          case 0: // trip planner
            break;
          case 1: // visualizer
            visualizerPanel_.initialize();
            break;
        }
      }
    });

    add(tabbedPane_, BorderLayout.CENTER);
  }

  public TripPlannerPanel getTripPlannerPanel() {
    return tripPlannerPanel_;
  }

  public VisualizerPanel getAnimatorPanel() {
    return visualizerPanel_;
  }
}
